import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        Solution solution=new Solution();
        char c='c';
         c=(char)(c+1);
       int len= solution.lengthOfLongestSubstring("fjghjhdg");
        System.out.println(len);
        System.out.println("Hello world!");
    }
}
class Solution {
    public int lengthOfLongestSubstring(String s) {
        char[] ss=s.toCharArray();
        int[] hash=new int[128 ];
        int left=0,right=0,n=s.length();
        int len=0;
        for(;right<n;right++){
            hash[ss[right]]++;
            while(hash[ss[right]]>1){
                hash[ss[left++]]--;
            }
            len=Math.max(len,right-left+1);
        }
        return len;
    }
}